angular.module('${menuCode}')
.filter('to_trusted', ['$sce', function ($sce) {
	return function (text) {
	    return $sce.trustAsHtml(text);
	};
}])
.controller("${widgetCode}Ctrl",function($scope,AppKit){
	AppKit.addSwipeSupport($scope);
	
	var url = '/portal/resource?MobileForumDataProvider&actionType=findForumInformations';
	var promise = AppKit.getJsonApi(url);
	promise.success(function(rspJson){
		$scope.applicationPlatform = rspJson.applicationPlatform;
		$scope.bracePlatform = rspJson.bracePlatform;		
		$scope.hotnewPosts = rspJson.hotnewPosts;
		$scope.integratePlatform = rspJson.integratePlatform;
	});	
	
	$scope.doSearch = function(){
		$scope.modalTitle = "搜索";
		AppKit.createModal("main-search-modal",$scope);
	}

	$scope.doPosting = function(){
		AppKit.createModal("bbs-post-modal",$scope);
	}
	
	$scope.info = {"fciCode":"selected","title":"","fpmExpression":"","points":"","fpmExpression":"selected","fpmContent":""}
	$scope.doPost = function(){
		var url = "/portal/resource?ForumPost&actionType=mobileCreatePostForumInfo"
		AppKit.postJsonApi(url,$scope.info).then(function(response){
			if ("success" == response.data){
				AppKit.successPopup();				
			}else{
				AppKit.errorPopup();
			}
		});
	}
	
	var url = '/portal/resource?MobileForumDataProvider&actionType=mobileIsGuest';
	var promise = AppKit.getJsonApi(url);
	promise.success(function(rspJson){
		$scope.isGuest = rspJson.isGuest;
	});
});